﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Win32;
using System.Diagnostics;

namespace SHack.Helper
{
    class ProcessHelper
    {
        public static void OpenUrl(string url)
        {
            Process p = new Process();
            p.StartInfo.FileName = GetIERunString();
            p.StartInfo.Arguments = url;
            p.Start();
        }

        public static void OpenCmd(string args)
        {
            Process p = new Process();
            p.StartInfo.FileName = "cmd.exe";
            p.StartInfo.Arguments = args;
            p.Start();
        }

        public static string GetIERunString()
        {
            string IEString = string.Empty;
            RegistryKey regKey = Registry.ClassesRoot;
            regKey = regKey.OpenSubKey(@"http\shell\open\command");
            IEString = regKey.GetValue("").ToString();
            string a = IEString;
            string[] b;
            b = a.Split(new char[1] { '"' });
            IEString = b[1];
            return IEString;
        }
    }
}
